home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / dev / moni / SystemViewer.lha / Source / SysPorts.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-19  |  16.0 KB  |  700 lines

  1. /****h* SysPorts/SysPorts.c *****************************************
  2. *
  3. * NAME
  4. *    SysPorts.c
  5. *
  6. * DESCRIPTION
  7. *
  8. *********************************************************************
  9. *
  10. */
  11.  
  12. #include <string.h>
  13.  
  14. #include <exec/types.h>
  15. #include <exec/execbase.h>
  16.  
  17. #include <AmigaDOSErrs.h>
  18.  
  19. #include <intuition/intuition.h>
  20. #include <intuition/classes.h>
  21. #include <intuition/classusr.h>
  22. #include <intuition/gadgetclass.h>
  23.  
  24. #include <libraries/gadtools.h>
  25.  
  26. #include <graphics/displayinfo.h>
  27. #include <graphics/gfxbase.h>
  28.  
  29. #include <clib/exec_protos.h>
  30. #include <clib/intuition_protos.h>
  31. #include <clib/gadtools_protos.h>
  32. #include <clib/graphics_protos.h>
  33. #include <clib/utility_protos.h>
  34. #include <clib/diskfont_protos.h>
  35.  
  36. #include "CPGM:GlobalObjects/CommonFuncs.h"
  37.  
  38. #include "SysLists.h"
  39.  
  40. #define PLV       0
  41. #define Update    1
  42. #define RemoveBt  2
  43. #define Priority  3
  44. #define Cancel    4
  45.  
  46. #define Po_CNT    5
  47.  
  48. #define PORTLVGAD PoGadgets[ PLV ]
  49.  
  50. PRIVATE char ver[] = "$VER: SysPorts 1.0 (18-Sep-2000) by J.T. Steichen";
  51.  
  52. PRIVATE struct TextFont     *PoFont  = NULL;
  53. PRIVATE struct Window       *PoWnd   = NULL;
  54. PRIVATE struct Gadget       *PoGList = NULL;
  55. PRIVATE struct IntuiMessage  PoMsg;
  56. PRIVATE struct Gadget       *PoGadgets[ Po_CNT ];
  57.  
  58. PRIVATE UWORD  PoLeft   = 0;
  59. PRIVATE UWORD  PoTop    = 16;
  60. PRIVATE UWORD  PoWidth  = 635;
  61. PRIVATE UWORD  PoHeight = 230;
  62. PRIVATE UBYTE *PoWdt    = (UBYTE *) "System Info (Ports):";
  63.  
  64. PRIVATE char *ltitle = "Address   Pri  PortName            Type     SigBit   Flags TaskName";
  65. PRIVATE char *fmt    = "%08LX %4d  %-19.19s %-7.7s  %08LX  %4LX %-24.24s";
  66.  
  67. PRIVATE ULONG PortAddress = 0L;
  68.  
  69. PRIVATE char  pn[80], *PortName = &pn[0];
  70.  
  71. PRIVATE struct List *DevListPtr = NULL;
  72.  
  73. // -------------------------------------------------------------------
  74.  
  75. #define MAXNODES   50
  76. #define NODELENGTH 80
  77.  
  78. PRIVATE struct List PLVList;
  79.  
  80. PRIVATE struct Node PLVNode;
  81. PRIVATE struct Node PLVNodes[ MAXNODES ] = { NULL, };
  82.  
  83. PRIVATE UBYTE       NodeStrs[ MAXNODES * NODELENGTH ] = "";
  84.  
  85. // -------------------------------------------------------------------
  86.  
  87. PRIVATE UWORD PoGTypes[] = {
  88.  
  89.    LISTVIEW_KIND, BUTTON_KIND, BUTTON_KIND,
  90.    BUTTON_KIND,   BUTTON_KIND
  91. };
  92.  
  93. PRIVATE int PLVClicked(      int whichitem );
  94. PRIVATE int UpdateClicked(   int dummy     );
  95. PRIVATE int RemoveClicked(   int dummy     );
  96. PRIVATE int PriorityClicked( int dummy     );
  97. PRIVATE int CancelClicked(   int dummy     );
  98.  
  99. PRIVATE struct NewGadget PoNGad[] = {
  100.  
  101.      2,   3, 627, 200,                 NULL, NULL, PLV, 
  102.    0, NULL, (APTR) PLVClicked,
  103.  
  104.      6, 205,  72,  17, (UBYTE *) "_Update",  NULL, Update, 
  105.    PLACETEXT_IN, NULL, (APTR) UpdateClicked,
  106.  
  107.    192, 205,  72,  17, (UBYTE *) "Remove",   NULL, RemoveBt, 
  108.    PLACETEXT_IN, NULL, (APTR) RemoveClicked,
  109.  
  110.    379, 205,  72,  17, (UBYTE *) "Priority", NULL, Priority, 
  111.    PLACETEXT_IN, NULL, (APTR) PriorityClicked,
  112.  
  113.    552, 205,  72,  17, (UBYTE *) "_Cancel",  NULL, Cancel, 
  114.    PLACETEXT_IN, NULL, (APTR) CancelClicked
  115. };
  116.  
  117. PRIVATE ULONG PoGTags[] = {
  118.  
  119.    LAYOUTA_Spacing,      2, 
  120.    GTLV_ShowSelected, NULL, 
  121.    GTLV_Selected,     TRUE, TAG_DONE,
  122.  
  123.    GT_Underscore,  '_', TAG_DONE,
  124.    TAG_DONE,
  125.    TAG_DONE,
  126.    GT_Underscore,  '_', TAG_DONE
  127. };
  128.  
  129. // ----------------------------------------------------------------------
  130.  
  131. PRIVATE char PortType[20] = "";
  132. PRIVATE char PortTask[32] = "";
  133.  
  134. PRIVATE ULONG PortSigBit = 0L;
  135. PRIVATE UBYTE PortFlags  = 0L;
  136.  
  137. PRIVATE char *GetPortType( struct Node *port )
  138. {
  139.    switch (port->ln_Type)
  140.       {
  141.       case NT_MSGPORT:
  142.          strcpy( &PortType[0], "MsgPort" );
  143.          break;
  144.          
  145.       case NT_UNKNOWN:
  146.       default:
  147.          strcpy( &PortType[0], "Unknown" );
  148.          break;
  149.       }
  150.       
  151.    return( &PortType[0] );
  152. }
  153.  
  154. PRIVATE ULONG GetPortSigBit( struct Node *port )
  155. {
  156.    struct MsgPort *mp = (struct MsgPort *) port;
  157.  
  158.    return( mp->mp_SigBit = PortSigBit );
  159. }
  160.  
  161. PRIVATE UBYTE GetPortFlags( struct Node *port )
  162. {
  163.    struct MsgPort *mp = (struct MsgPort *) port;
  164.    
  165.    return( mp->mp_Flags = PortFlags );
  166. }
  167.  
  168. PRIVATE char *GetPortTaskName( struct Node *port )
  169. {
  170.    struct MsgPort *mp    = (struct MsgPort *) port;
  171.    struct Task    *ptask = NULL;
  172.    
  173.    if (mp != NULL)
  174.       ptask = (struct Task *) mp->mp_SigTask;
  175.  
  176.    if (ptask != NULL)
  177.       { 
  178.       if (ptask->tc_Node.ln_Type == NT_TASK ||
  179.           ptask->tc_Node.ln_Type == NT_PROCESS)
  180.          {
  181.          if (strlen( ptask->tc_Node.ln_Name ) > 1)   
  182.             strcpy( &PortTask[0], ptask->tc_Node.ln_Name );
  183.          else
  184.             strcpy( &PortTask[0], "No Task Name!" );  
  185.          } 
  186.       else
  187.          strcpy( &PortTask[0], "No Task Node!" );   
  188.       }
  189.    else
  190.       strcpy( &PortTask[0], "No Task Ptr!" );   
  191.  
  192.    return( &PortTask[0] );
  193. }
  194.  
  195. PRIVATE BOOL ValidName( char *name )
  196. {
  197.    BOOL rval = TRUE;
  198.    int  len  = strlen( name ), i = 0;
  199.  
  200.    if (len < 1)
  201.       {
  202.       rval = FALSE;
  203.       return( rval );
  204.       }
  205.  
  206.    while (i < len)
  207.       {
  208.       if ((*(name + i) > 0x7E) || (*(name + i) < 0x20))
  209.          {
  210.          rval = FALSE;
  211.          break;
  212.          }
  213.  
  214.       i++;
  215.       }   
  216.  
  217.    return( rval );
  218. }
  219.  
  220. PRIVATE int MakePortList( void )
  221. {
  222.    IMPORT struct ExecBase *SysBase;
  223.  
  224.    struct List    *portslist;
  225.    struct Node    *ptr;   
  226.    struct MsgPort *mport;
  227.    
  228.    char *nm = NULL;
  229.    int   i  = 1; // Don't overwrite the Column headers.
  230.    
  231.    // First node is column heads:   
  232.    strncpy( &NodeStrs[0], ltitle, NODELENGTH - 1 );
  233.    
  234.    HideListFromView( PORTLVGAD, PoWnd );
  235.  
  236.    Forbid();
  237.  
  238.      portslist = &SysBase->PortList;
  239.      ptr       = portslist->lh_Head;
  240.      mport     = (struct MsgPort *) ptr;
  241.  
  242.      while ((i <= MAXNODES) && (mport != NULL))
  243.         {
  244.         nm = mport->mp_Node.ln_Name;
  245.  
  246.         if (strlen( nm ) < 1)
  247.            goto SkipBlankPortName;
  248.  
  249.         // "Address  Pri  PortName  Type  SigBit  Flags TaskName";
  250.         sprintf( &NodeStrs[ NODELENGTH * i++ ], fmt,
  251.                  mport, 
  252.                  mport->mp_Node.ln_Pri,
  253.                  (nm == NULL ? "** NO NAME **" : nm),
  254.                  GetPortType(     (struct Node *) mport ),
  255.                  mport->mp_SigBit,
  256.                  mport->mp_Flags,
  257.                  GetPortTaskName( (struct Node *) mport )
  258.                );
  259.  
  260. SkipBlankPortName:
  261.          
  262.         mport = ((struct MsgPort *) mport)->mp_Node.ln_Succ;
  263.         } 
  264.  
  265.    Permit();
  266.  
  267.    GT_SetGadgetAttrs( PORTLVGAD, PoWnd, NULL,
  268.                       GTLV_Labels,       &PLVList,
  269.                       GTLV_Selected,     1,
  270.                       TAG_END
  271.                     );
  272.  
  273.    SetWindowTitles( PoWnd, PoWdt, (UBYTE *) -1 );
  274.  
  275.    return( i );
  276. }
  277.  
  278.  
  279. PRIVATE void ClosePoWindow( void )
  280. {
  281.    if (PoWnd != NULL)
  282.       {
  283.       CloseWindow( PoWnd );
  284.       PoWnd = NULL;
  285.       }
  286.  
  287.    if (PoGList != NULL)
  288.       {
  289.       FreeGadgets( PoGList );
  290.       PoGList = NULL;
  291.       }
  292.  
  293.    if (PoFont != NULL)
  294.       {
  295.       CloseFont( PoFont );
  296.       PoFont = NULL;
  297.       }
  298.  
  299.    return;
  300. }
  301.  
  302. PRIVATE int PoCloseWindow( void )
  303. {
  304.    ClosePoWindow();
  305.    return( (int) FALSE );
  306. }
  307.  
  308. PRIVATE int PLVClicked( int itemnum )
  309. {
  310.    ULONG addr = 0L;
  311.    
  312. //#  ifdef DEBUG
  313. //   fprintf( stderr, "%-80.80s\n", PLVNodes[ itemnum ].ln_Name );
  314. //#  endif
  315.  
  316.    if (itemnum == 0)   
  317.       {
  318.       GT_SetGadgetAttrs( PoGadgets[ RemoveBt ], PoWnd, NULL,
  319.                          GA_Disabled, TRUE, TAG_DONE 
  320.                        );
  321.  
  322.       GT_SetGadgetAttrs( PoGadgets[ Priority ], PoWnd, NULL,
  323.                          GA_Disabled, TRUE, TAG_DONE 
  324.                        );
  325.  
  326.       return( (int) TRUE );
  327.       }
  328.    else
  329.       {
  330.       GT_SetGadgetAttrs( PoGadgets[ RemoveBt ], PoWnd, NULL,
  331.                          GA_Disabled, FALSE, TAG_DONE 
  332.                        );
  333.  
  334.       GT_SetGadgetAttrs( PoGadgets[ Priority ], PoWnd, NULL,
  335.                          GA_Disabled, FALSE, TAG_DONE 
  336.                        );
  337.  
  338.       // Now get address from the item:
  339.       (void) stch_l( PLVNodes[ itemnum ].ln_Name, (long *) &addr );
  340.  
  341.       PortAddress = addr;
  342.       }
  343.  
  344.    return( (int) TRUE );
  345. }
  346.  
  347. PRIVATE int UpdateClicked( int dummy )
  348. {
  349.    int i;
  350.  
  351.    SetWindowTitles( PoWnd, "Updating Port List...", (UBYTE *) 0xFFFFFFFF );
  352.  
  353.    HideListFromView( PORTLVGAD, PoWnd );   
  354.  
  355.    for (i = 1; i <= MAXNODES; i++)
  356.        NodeStrs[ i * NODELENGTH ] = '\0'; // Kill old ListView strings.
  357.  
  358.    // Make the list:
  359.    (void) MakePortList();
  360.  
  361.    ModifyListView( PORTLVGAD, PoWnd, &PLVList, NULL );
  362.  
  363.    GT_RefreshWindow( PoWnd, NULL );
  364.  
  365.    return( (int) TRUE );
  366. }
  367.  
  368. // ---------------------------------------------------------------------
  369.  
  370. PRIVATE BOOL IsMsgPort_Empty( struct MsgPort *p )
  371. {
  372.    BOOL rval = FALSE;
  373.  
  374.    if (p == NULL)
  375.       return( TRUE );
  376.  
  377.    if (p->mp_MsgList.lh_TailPred == (struct Node *) &(p->mp_MsgList))
  378.       rval = TRUE;
  379.    
  380.    return( rval );
  381. }
  382.      
  383. PRIVATE void RemovePortSafely( struct MsgPort *port )
  384. {
  385.    struct Node *MsgNode = NULL;
  386.  
  387.    if (port == NULL)
  388.       return;
  389.  
  390.    Forbid();
  391.  
  392.      if (IsMsgPort_Empty( port ) == FALSE)
  393.         {
  394.         MsgNode = port->mp_MsgList.lh_Head;
  395.  
  396.         while ((MsgNode = MsgNode->ln_Succ) != NULL)
  397.            Remove( (struct Node *) MsgNode );
  398.         }
  399.  
  400.      if (port->mp_Node.ln_Name != NULL)
  401.         RemPort( port );
  402.  
  403.      port->mp_SigTask         = (struct Task *) -1;
  404.      port->mp_MsgList.lh_Head = (struct Node *) -1;
  405.  
  406.      DeletePort( port );
  407.  
  408.   Permit();
  409.  
  410.   return;
  411. }
  412.  
  413. PRIVATE int RemoveClicked( int dummy )
  414. {
  415.    int   answer = -1;
  416.  
  417.    if (PortAddress == NULL)
  418.       {
  419.       SetReqButtons( "OKAY!" );
  420.  
  421.       (void) Handle_Problem( "Select a valid Port first!",
  422.                              "User ERROR:", NULL
  423.                            );      
  424.  
  425.       SetReqButtons( "CONTINUE|ABORT!" );
  426.       return( (int) TRUE );
  427.       }
  428.  
  429.    sprintf( ErrMsg, "Are you SURE you want to Remove %08x?", PortAddress );
  430.  
  431.    answer = SanityCheck( ErrMsg );
  432.  
  433.    if (answer == TRUE)
  434.       RemovePortSafely( (struct MsgPort *) PortAddress );
  435.  
  436.    return( (int) TRUE );
  437. }
  438.  
  439. // ---------------------------------------------------------------------
  440.  
  441. PRIVATE int PriorityClicked( int dummy )
  442. {
  443.    int  answer = -1;
  444.    
  445.    if (PortAddress == NULL)
  446.       {
  447.       SetReqButtons( "OKAY!" );
  448.  
  449.       (void) Handle_Problem( "Select a valid Port first!",
  450.                              "User ERROR:", NULL
  451.                            );      
  452.  
  453.       SetReqButtons( "CONTINUE|ABORT!" );
  454.       return( (int) TRUE );
  455.       }
  456.  
  457.    sprintf( ErrMsg, "Are you SURE you want to Re-Prioritize %08x?", 
  458.             PortAddress 
  459.           );
  460.  
  461.    answer = SanityCheck( ErrMsg );
  462.  
  463.    if (answer == TRUE)
  464.       {
  465.       ULONG  OldPri = ((struct Node *) PortAddress)->ln_Pri;
  466.       char  *name   = ((struct Node *) PortAddress)->ln_Name;
  467.  
  468.       if (ChangePriorityHandler( name, NT_MSGPORT, OldPri ) < 0)
  469.          {
  470.          // Error condition:
  471.          sprintf( ErrMsg, "Couldn't open Priority Requester!" );
  472.  
  473.          SetReqButtons( "OKAY!" );
  474.  
  475.          (void) Handle_Problem( ErrMsg, "System Problem:", NULL );
  476.  
  477.          SetReqButtons( "CONTINUE|ABORT!" );
  478.          }
  479.       }
  480.  
  481.    return( (int) TRUE );
  482. }
  483.  
  484. PRIVATE int CancelClicked( int dummy )
  485. {
  486.    return( PoCloseWindow() );
  487. }
  488.  
  489. // -----------------------------------------------------------------
  490.  
  491. PRIVATE int OpenPoWindow( void )
  492. {
  493.    struct NewGadget  ng;
  494.    struct Gadget    *g;
  495.    UWORD             lc, tc;
  496.    UWORD             wleft = PoLeft, wtop = PoTop, ww, wh;
  497.  
  498.    ComputeFont( Scr, Font, &CFont, PoWidth, PoHeight );
  499.  
  500.    ww = ComputeX( CFont.FontX, PoWidth );
  501.    wh = ComputeY( CFont.FontY, PoHeight );
  502.  
  503.    if ((wleft + ww + CFont.OffX + Scr->WBorRight) > Scr->Width)
  504.       wleft = Scr->Width - ww;
  505.  
  506.    if ((wtop + wh + CFont.OffY + Scr->WBorBottom) > Scr->Height)
  507.       wtop = Scr->Height - wh;
  508.  
  509.    if ((PoFont = OpenDiskFont( Font )) == NULL)
  510.       return( -5 );
  511.  
  512.    if ((g = CreateContext( &PoGList )) == NULL)
  513.       return( -1 );
  514.  
  515.    for (lc = 0, tc = 0; lc < Po_CNT; lc++)
  516.       {
  517.       CopyMem( (char *) &PoNGad[lc], (char *) &ng, 
  518.                (long) sizeof( struct NewGadget )
  519.              );
  520.  
  521.       ng.ng_VisualInfo = VisualInfo;
  522.       ng.ng_TextAttr   = Font;
  523.  
  524.       ng.ng_LeftEdge   = CFont.OffX + ComputeX( CFont.FontX, 
  525.                                                 ng.ng_LeftEdge
  526.                                               );
  527.  
  528.       ng.ng_TopEdge    = CFont.OffY + ComputeY( CFont.FontY, 
  529.                                                 ng.ng_TopEdge
  530.                                               );
  531.  
  532.       ng.ng_Width      = ComputeX( CFont.FontX, ng.ng_Width );
  533.       ng.ng_Height     = ComputeY( CFont.FontY, ng.ng_Height );
  534.  
  535.       PoGadgets[lc] = g = CreateGadgetA( (ULONG) PoGTypes[lc], 
  536.                             g, 
  537.                             &ng, 
  538.                             (struct TagItem *) &PoGTags[tc] );
  539.  
  540.       while ( PoGTags[tc] )
  541.          tc += 2;
  542.  
  543.       tc++;
  544.  
  545.       if (g == NULL)
  546.          return( -2 );
  547.       }
  548.  
  549.    if ((PoWnd = OpenWindowTags( NULL,
  550.  
  551.                  WA_Left,        wleft,
  552.                  WA_Top,         wtop,
  553.                  WA_Width,       ww + CFont.OffX + Scr->WBorRight,
  554.                  WA_Height,      wh + CFont.OffY + Scr->WBorBottom,
  555.                  
  556.                  WA_IDCMP,       LISTVIEWIDCMP | BUTTONIDCMP 
  557.                    | IDCMP_CLOSEWINDOW | IDCMP_REFRESHWINDOW 
  558.                    | IDCMP_VANILLAKEY,
  559.                  
  560.                  WA_Flags,       WFLG_DRAGBAR | WFLG_DEPTHGADGET 
  561.                    | WFLG_CLOSEGADGET | WFLG_SMART_REFRESH 
  562.                    | WFLG_ACTIVATE | WFLG_RMBTRAP,
  563.                  
  564.                  WA_Gadgets,     PoGList,
  565.                  WA_Title,       PoWdt,
  566.                  WA_ScreenTitle, ScrTitle,
  567.                  TAG_DONE )
  568.       ) == NULL)
  569.       return( -4 );
  570.  
  571.    GT_RefreshWindow( PoWnd, NULL );
  572.  
  573.    return( 0 );
  574. }
  575.  
  576. PRIVATE int PoVanillaKey( int whichkey )
  577. {
  578.    int rval = TRUE;
  579.    
  580.    switch (whichkey)
  581.       {
  582.       case 'u':
  583.       case 'U':
  584.          rval = UpdateClicked( 0 );
  585.          break;
  586.                
  587.       case 'c':
  588.       case 'C':
  589.       case 'x':
  590.       case 'X':
  591.       case 'q':
  592.       case 'Q':
  593.          rval = CancelClicked( 0 );
  594.  
  595.       default:
  596.          break;
  597.       }
  598.  
  599.    return( rval );
  600. }
  601.  
  602. PRIVATE int HandlePoIDCMP( void )
  603. {
  604.    struct IntuiMessage  *m;
  605.    int                 (*func)( int code );
  606.    BOOL                  running = TRUE;
  607.  
  608.    while (running == TRUE)
  609.       {
  610.       if ((m = GT_GetIMsg( PoWnd->UserPort )) == NULL)
  611.          {
  612.          (void) Wait( 1L << PoWnd->UserPort->mp_SigBit );
  613.          continue;
  614.          }
  615.  
  616.       CopyMem( (char *) m, (char *) &PoMsg, 
  617.                (long) sizeof( struct IntuiMessage )
  618.              );
  619.  
  620.       GT_ReplyIMsg( m );
  621.  
  622.       switch (PoMsg.Class)
  623.          {
  624.          case IDCMP_REFRESHWINDOW:
  625.             GT_BeginRefresh( PoWnd );
  626.             GT_EndRefresh( PoWnd, TRUE );
  627.             break;
  628.  
  629.          case IDCMP_CLOSEWINDOW:
  630.             running = PoCloseWindow();
  631.             break;
  632.  
  633.          case IDCMP_VANILLAKEY:
  634.             running = PoVanillaKey( (int) PoMsg.Code ); 
  635.             break;
  636.              
  637.          case IDCMP_GADGETUP:
  638.          case IDCMP_GADGETDOWN:
  639.             func = (void *) ((struct Gadget *) PoMsg.IAddress)->UserData;
  640.  
  641.             if (func != NULL)
  642.                running = func( (int) PoMsg.Code );
  643.  
  644.             break;
  645.          }
  646.       }
  647.  
  648.    return( running );
  649. }
  650.  
  651. PUBLIC int main( void )
  652. {
  653.    int i = 0;
  654.  
  655.    if (SetupSystemList( &OpenPoWindow ) < 0)
  656.       {
  657.       fprintf( stderr, "Couldn't open a System ListViewer!\n" );
  658.       return( RETURN_FAIL );
  659.       }
  660.    
  661.    SetNotifyWindow( PoWnd );
  662.  
  663.    SetWindowTitles( PoWnd, "Making Port List...", (UBYTE *) 0xFFFFFFFF );
  664.  
  665.    PLVNode.ln_Succ = (struct Node *) PLVList.lh_Tail;
  666.    PLVNode.ln_Pred = (struct Node *) PLVList.lh_Head;
  667.    PLVNode.ln_Type = 0;
  668.    PLVNode.ln_Pri  = MAXNODES - 129;
  669.    PLVNode.ln_Name = ltitle;
  670.  
  671.    PLVNodes[0] = PLVNode;
  672.  
  673.  
  674.    for (i = 1; i <= MAXNODES; i++)
  675.       {
  676.       PLVNodes[i].ln_Name = &NodeStrs[ i * NODELENGTH ];
  677.       PLVNodes[i].ln_Pri  = MAXNODES - i - 129;
  678.       }
  679.  
  680.    NewList( (struct List *) &PLVList );      
  681.  
  682.    for (i = 0; i < MAXNODES; i++)
  683.       Enqueue( (struct List *) &PLVList, &PLVNodes[ i ] );
  684.  
  685.    // Make the list:
  686.    (void) MakePortList();
  687.  
  688.    ModifyListView( PORTLVGAD, PoWnd, (struct List *) &PLVList, NULL );
  689.  
  690.    GT_RefreshWindow( PoWnd, NULL );
  691.  
  692.    (void) HandlePoIDCMP();
  693.    
  694.    ShutdownSystemList();
  695.  
  696.    return( RETURN_OK );
  697. }
  698.  
  699. /* ---------------------- END of SysPorts.c file! -------------------- */ 
  700.